package jianzhi_offer;

public class _49_数组中重复的数字 {
    public boolean duplicate(int numbers[],int length,int [] duplication) {
        if(numbers == null || numbers.length == 0) return false;
        boolean flag = false;//标识0出现过没有
        for(int i:numbers){
            i = Math.abs(i);
            if(i == 0){
                if(flag) return false;
                flag = true;
            }else{
                if(numbers[i] < 0) {
                    duplication[0] = i;
                    return true;
                }else{
                    numbers[i] *= -1;
                }
            }
        }
        return false;
    }
}
